Skip to content

Conversation

@agullon
Copy link

@agullon agullon commented Oct 29, 2025

What this PR does / why we need it:

This PR adds a new Claude Code plugin for analyzing MicroShift Prow CI job executions and test results. The microshift-prow-job plugin provides automated analysis tools for MicroShift CI jobs running on OpenShift's Prow CI infrastructure. It helps developers and QE engineers quickly understand test results, diagnose failures, and track MicroShift versions across different test configurations.

Commands Added:

  • /microshift-prow-job:analyze-job <job-url>
    • Analyzes a complete MicroShift Prow CI job execution with job metadata, version detection, test results, and failure analysis
  • /microshift-prow-job:analyze-test-scenario <job-url> [scenario-name]
    • Analyzes specific test scenarios with structured JSON output, or lists all scenarios if no name provided

Special notes for your reviewer:

  • This plugin is specifically designed for MicroShift Prow CI jobs and understands their unique structure (scenario-info artifacts, test naming conventions, etc.)
  • The extract_microshift_version.py script automatically classifies build types (nightly, EC, RC, zstream) based on version string patterns
  • Commands follow the repository's established conventions (Linux man page format with Name, Synopsis, Description, Implementation, Arguments, Return Value, Examples sections)
  • The plugin gracefully handles missing artifacts and provides helpful error messages when jobs are not found or still running
  • Tested with multiple job types and scenarios including passing/failing jobs across all architectures and image types

Summary by CodeRabbit

  • New Features

    • Introduced MicroShift Prow Job plugin to analyze Prow CI test jobs.
    • Adds two user commands: analyze entire job and analyze individual test scenarios.
    • Adds a helper capability to extract MicroShift version and classify build types.
    • Produces detailed reports with test results, metadata, artifacts, and logs.
  • Documentation

    • Comprehensive README and command guides with usage examples and troubleshooting.

@openshift-ci openshift-ci bot requested review from dgoodwin and enxebre October 29, 2025 10:56
@openshift-merge-robot openshift-merge-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Oct 29, 2025
@agullon agullon changed the title Add microshift-prow-jobs plugin feat: add microshift-prow-jobs plugin Oct 29, 2025
@agullon
Copy link
Author

agullon commented Oct 29, 2025

/retest

@agullon
Copy link
Author

agullon commented Oct 29, 2025

/test images

Copy link
Member

@stbenjam stbenjam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice contribution thanks, a few comments below

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could it just be part of prow-jobs? microshift-prow-jobs feels a little too specialized. Either a microshift plugin, or contribute it to the prow-jobs plugin will make it more discoverable for other folks who might be debugging various CI jobs

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's value on a more specialized prow-job plugin only for microshift because MicroShift tests are not based on ginkgo test suites but on Robot Framework.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just a dedicated microshift plugin then? /microshift-prow-job:analyze-test-scenario is quite long

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean renaming the plugin from microshift-prow-job to microshift ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, microshift-prow-job is too long and too specific IMHO.

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
@agullon agullon force-pushed the microshift-prow-jobs_plugin branch from 0bdc57d to 22ba531 Compare October 29, 2025 15:34
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 29, 2025
@agullon agullon closed this Oct 29, 2025
@agullon agullon force-pushed the microshift-prow-jobs_plugin branch from 22ba531 to a05beda Compare October 29, 2025 15:35
rh-pre-commit.check-secrets: ENABLED
…elpers into microshift-prow-jobs_plugin

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
@agullon agullon reopened this Oct 29, 2025
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 29, 2025
@openshift-ci
Copy link

openshift-ci bot commented Oct 29, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: agullon
Once this PR has been reviewed and has the lgtm label, please assign bentito for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@openshift-ci
Copy link

openshift-ci bot commented Oct 29, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: agullon
Once this PR has been reviewed and has the lgtm label, please assign bentito for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
@agullon
Copy link
Author

agullon commented Oct 29, 2025

Nice contribution thanks, a few comments below

@stbenjam thank you for comments. Creating and testing this plugin really helped me to understand how a LLM "is thinking", how I should ask tasks and what to expect as an output. It really shines when the task/skill is small and concise. Also, it works great, in particular when generating the output, with human-readable text (for example md files) but not with structure data (json format.).

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 4, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

Walkthrough

Adds a new "microshift-prow-job" plugin: marketplace registration, plugin manifest, README, two command docs (analyze-job, analyze-test-scenario), a version-extraction skill with implementation script, and updates to docs/data.json and PLUGINS.md.

Changes

Cohort / File(s) Change Summary
Marketplace & Index
\.claude-plugin/marketplace.json, PLUGINS.md
Added plugin entry to marketplace.json and new "Microshift Prow Job" section in PLUGINS.md linking to the plugin README and commands.
Plugin Manifest
plugins/microshift-prow-job/.claude-plugin/plugin.json
New plugin manifest with name, description, version, and author/contact metadata.
Plugin README
plugins/microshift-prow-job/README.md
Added README describing plugin purpose, commands, installation, usage examples, outputs, troubleshooting, and contributing notes.
Command Documentation
plugins/microshift-prow-job/commands/analyze-job.md, plugins/microshift-prow-job/commands/analyze-test-scenario.md
Added design and usage docs for /microshift-prow-job:analyze-job and /microshift-prow-job:analyze-test-scenario, including inputs, artifact URL handling, parsing logic, examples, and error cases.
Skill Docs & Implementation
plugins/microshift-prow-job/skills/extract-microshift-version/SKILL.md, plugins/microshift-prow-job/skills/extract-microshift-version/extract_microshift_version.py
Added skill documentation and Python script to fetch build logs, extract MicroShift version, determine build type (nightly/rc/ec/zstream), and emit structured JSON; includes helper functions and CLI entry point.
Public Index
docs/data.json
Added public plugin entry for microshift-prow-job with version, commands, skill, and has_readme flag.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor User
    participant JobCmd as /microshift-prow-job:analyze-job
    participant ScenarioCmd as /microshift-prow-job:analyze-test-scenario
    participant VersionSkill as extract-microshift-version
    participant GCS as Prow Artifacts (GCS)

    User->>JobCmd: invoke with <job-url>
    JobCmd->>GCS: fetch finished.json & started.json
    JobCmd->>VersionSkill: request version (job_id, job_type)
    VersionSkill->>GCS: fetch build log (rf-debug.log)
    VersionSkill-->>JobCmd: {success, version, build_type, url}
    JobCmd->>ScenarioCmd: for each scenario -> analyze
    ScenarioCmd->>GCS: fetch JUnit XML, logs, artifacts
    ScenarioCmd-->>JobCmd: scenario results and artifact links
    JobCmd-->>User: aggregated Markdown and JSON report
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Files needing extra attention:
    • plugins/microshift-prow-job/skills/extract-microshift-version/extract_microshift_version.py — SSL certificate handling, network error handling, regex version extraction, and build-type classification.
    • plugins/microshift-prow-job/commands/*.md — artifact URL assumptions vs. real Prow/GCS structure and example consistency.
    • docs/data.json and .claude-plugin/marketplace.json — confirm metadata fields and registration format.

Pre-merge checks and finishing touches

✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add microshift-prow-jobs plugin' directly corresponds to the main change: adding a new MicroShift Prow job analyzer plugin with commands and supporting documentation.
No Real People Names In Style References ✅ Passed Comprehensive search of all plugin files, documentation, commands, skills, and code found no references to real people by name in style references, example prompts, instructions, or documentation.
No Assumed Git Remote Names ✅ Passed No hardcoded git remote names like 'origin' or 'upstream' found in any plugin files.
Git Push Safety Rules ✅ Passed Pull request contains only read-only analysis operations with no git push, force push, or autonomous commit workflows.
No Untrusted Mcp Servers ✅ Passed The PR adds a Python-based Claude Code plugin with only standard library dependencies; no MCP servers or untrusted external packages are installed.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (5)
plugins/microshift-prow-job/README.md (2)

31-41: Add language specifiers to fenced code blocks.

The code blocks at lines 31, 39 should specify language identifiers for proper syntax highlighting and markdown compliance.

Apply this pattern:

-```
+```bash
 /microshift-prow-job:analyze-job <job-url>

---

`52-73`: **Add language specifiers to fenced code blocks.**

Code blocks at lines 52, 64, 69 should specify language identifiers (likely 'bash' or 'text').

</blockquote></details>
<details>
<summary>plugins/microshift-prow-job/commands/analyze-job.md (1)</summary><blockquote>

`1-417`: **Excellent command documentation!**

The command documentation is thorough and follows the repository's man page format conventions. Implementation steps are well-detailed and include error handling scenarios.



Consider adding language specifiers to fenced code blocks (e.g., 'bash', 'json', 'markdown') for better syntax highlighting and markdown compliance.

</blockquote></details>
<details>
<summary>plugins/microshift-prow-job/commands/analyze-test-scenario.md (1)</summary><blockquote>

`1-405`: **Well-documented command with good UX design!**

The command documentation is thorough and the optional scenario parameter design (listing scenarios when omitted) provides good user experience.



Consider adding language specifiers to fenced code blocks throughout the document for markdown compliance.

</blockquote></details>
<details>
<summary>plugins/microshift-prow-job/skills/extract-microshift-version/SKILL.md (1)</summary><blockquote>

`1-185`: **Excellent skill documentation!**

The documentation thoroughly covers the skill's purpose, usage, parameters, error handling, and integration examples. Very helpful for users of the plugin.



Consider adding language specifiers to the fenced code blocks at lines 154 and 172 for markdown compliance.

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used**: CodeRabbit UI

**Review profile**: CHILL

**Plan**: Pro

**Cache: Disabled due to data retention organization setting**

**Knowledge base: Disabled due to `Reviews -> Disable Knowledge Base` setting**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between a05beda83ed0a1a83afbd103a0c4a4115180a802 and 5803e3a160e0d5b522994f2c7fefe04ca6eabee9.

</details>

<details>
<summary>📒 Files selected for processing (8)</summary>

* `.claude-plugin/marketplace.json` (1 hunks)
* `PLUGINS.md` (2 hunks)
* `plugins/microshift-prow-job/.claude-plugin/plugin.json` (1 hunks)
* `plugins/microshift-prow-job/README.md` (1 hunks)
* `plugins/microshift-prow-job/commands/analyze-job.md` (1 hunks)
* `plugins/microshift-prow-job/commands/analyze-test-scenario.md` (1 hunks)
* `plugins/microshift-prow-job/skills/extract-microshift-version/SKILL.md` (1 hunks)
* `plugins/microshift-prow-job/skills/extract-microshift-version/extract_microshift_version.py` (1 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.18.1)</summary>

<details>
<summary>plugins/microshift-prow-job/README.md</summary>

31-31: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

39-39: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

52-52: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

64-64: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

69-69: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

149-149: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

157-157: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

332-332: Bare URL used

(MD034, no-bare-urls)

</details>
<details>
<summary>plugins/microshift-prow-job/commands/analyze-test-scenario.md</summary>

10-10: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

91-91: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

106-106: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

114-114: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

267-267: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

279-279: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

288-288: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

302-302: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

307-307: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

341-341: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

346-346: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

361-361: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

366-366: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>
<details>
<summary>plugins/microshift-prow-job/skills/extract-microshift-version/SKILL.md</summary>

154-154: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

172-172: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>
<details>
<summary>plugins/microshift-prow-job/commands/analyze-job.md</summary>

10-10: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

91-91: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

106-106: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

114-114: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

267-267: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

279-279: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

288-288: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

302-302: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

307-307: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

341-341: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

346-346: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

361-361: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

366-366: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>
<details>
<summary>🪛 Ruff (0.14.3)</summary>

<details>
<summary>plugins/microshift-prow-job/skills/extract-microshift-version/extract_microshift_version.py</summary>

51-51: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.

(S310)

---

56-56: Do not catch blind exception: `Exception`

(BLE001)

</details>

</details>

</details>

<details>
<summary>🔇 Additional comments (8)</summary><blockquote>

<details>
<summary>plugins/microshift-prow-job/.claude-plugin/plugin.json (1)</summary><blockquote>

`1-10`: **LGTM! Plugin manifest is well-structured.**

The plugin manifest contains all required metadata with appropriate values for a new plugin.

</blockquote></details>
<details>
<summary>.claude-plugin/marketplace.json (1)</summary><blockquote>

`67-71`: **LGTM! Marketplace entry follows conventions.**

The marketplace entry is properly formatted and consistent with other plugin entries.

</blockquote></details>
<details>
<summary>PLUGINS.md (2)</summary><blockquote>

`11-11`: **LGTM! Navigation entry added correctly.**

The plugin navigation link follows the established format.

---

`84-92`: **LGTM! Plugin section is well-documented.**

The plugin section provides clear command descriptions and links to detailed documentation, consistent with other plugins.

</blockquote></details>
<details>
<summary>plugins/microshift-prow-job/README.md (1)</summary><blockquote>

`1-335`: **Excellent comprehensive documentation!**

The README provides thorough coverage of plugin functionality, installation, usage examples, troubleshooting, and test scenario details. This will be very helpful for users.

</blockquote></details>
<details>
<summary>plugins/microshift-prow-job/skills/extract-microshift-version/extract_microshift_version.py (3)</summary><blockquote>

`33-39`: **LGTM! URL construction is clear.**

The function builds GCS URLs in a straightforward manner with appropriate path components.

---

`60-76`: **LGTM! Version extraction logic is sound.**

The regex pattern appropriately matches the version string format in the build logs.

---

`95-148`: **LGTM! Main function is well-structured.**

The main function has clear flow, appropriate error handling, and consistent JSON output format.

</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 4, 2025
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
…elpers into microshift-prow-jobs_plugin

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
plugins/microshift-prow-job/skills/extract-microshift-version/extract_microshift_version.py (1)

112-132: Add input validation to prevent malformed URLs; restrict to safe character patterns.

The inputs are embedded directly into URL construction without character validation. While GCS services have access controls, defensive validation against path traversal patterns and unexpected characters is prudent. Restrict job_id, version, and job_type to expected formats (alphanumeric, hyphens, underscores, dots).

    if not job_type or not job_type.strip():
        print(json.dumps({
            "success": False,
            "error": "job_type cannot be empty"
        }))
        sys.exit(1)

+   # Validate inputs against safe character set to prevent URL malformation
+   import string
+   safe_chars = set(string.ascii_letters + string.digits + '-._')
+   
+   for param_name, param_value in [("job_id", job_id), ("version", version), ("job_type", job_type)]:
+       if not all(c in safe_chars for c in param_value):
+           print(json.dumps({
+               "success": False,
+               "error": f"{param_name} contains invalid characters. Only alphanumeric, hyphen, underscore, and dot are allowed"
+           }))
+           sys.exit(1)
🧹 Nitpick comments (1)
plugins/microshift-prow-job/skills/extract-microshift-version/extract_microshift_version.py (1)

45-61: Good improvements on URL validation and exception handling.

The addition of URL scheme validation (lines 45-47) and specific exception handlers (lines 60-61) addresses previous security concerns. The SSL certificate verification is intentionally disabled for internal CI environments, which is acceptable.

Minor improvement:

Apply this diff to remove unnecessary f-string prefix:

         if not url.startswith('https://'):
-            return None, f"Invalid URL scheme. Only HTTPS URLs are supported."
+            return None, "Invalid URL scheme. Only HTTPS URLs are supported."

Based on learnings

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 1970908 and 7d85c69.

📒 Files selected for processing (2)
  • docs/data.json (1 hunks)
  • plugins/microshift-prow-job/skills/extract-microshift-version/extract_microshift_version.py (1 hunks)
🧰 Additional context used
🪛 Ruff (0.14.3)
plugins/microshift-prow-job/skills/extract-microshift-version/extract_microshift_version.py

47-47: f-string without any placeholders

Remove extraneous f prefix

(F541)


55-55: Audit URL open for permitted schemes. Allowing use of file: or custom schemes is often unexpected.

(S310)

🔇 Additional comments (1)
docs/data.json (1)

561-587: LGTM! Plugin registration is well-structured.

The new microshift-prow-job plugin registration follows the established pattern of other plugins in the repository, with properly defined commands and skills.

@agullon
Copy link
Author

agullon commented Nov 6, 2025

@stbenjam can you please review this again?

@agullon agullon requested a review from stbenjam November 10, 2025 16:13
@agullon
Copy link
Author

agullon commented Nov 12, 2025

@stbenjam I was thinking probably it makes more sense to add these commands into the microshift repo itself. Because they only target test executed from this repo and also other team members are adding more comments.

Do you mind I close this PR and open another in the microshift repo?

@agullon
Copy link
Author

agullon commented Nov 17, 2025

I think it makes more sense to add these 2 commands in microshift repository, so I'll close this PR in favor of openshift/microshift#5754 PR.

@agullon agullon closed this Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants